package com.github.boluo1230.wechat.entity.message;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import java.io.Serializable;

@Slf4j
@Getter
@Setter
public class WxCustomNews implements WxCustomMsg, Serializable {
    @JsonProperty("touser")
    private String toUser;

    @JsonProperty("msgtype")
    private String msgType = "mpnews";

    @JsonProperty("mpnews")
    private WxCustomNews.News news;

    public WxCustomNews(String openId, String mediaId) {
        this.setToUser(openId);
        this.setNews(new WxCustomNews.News(mediaId));
    }

    @Getter
    @Setter
    public class News {
        @JsonProperty("media_id")
        private String mediaId;

        public News(String mediaId) {
            this.setMediaId(mediaId);
        }
    }
}
